package com.fixme4trade.domain;

import java.io.Serializable;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.MappedSuperclass;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.NotEmpty;
import com.fixme4trade.constant.PaymentStatus;


@Entity 
@Inheritance(strategy = InheritanceType.JOINED)
//@MappedSuperclass
public abstract class Payment implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue
	@Column(name="payment_id")
	private long id;
	
	@OneToOne(cascade=CascadeType.ALL, optional=false, fetch=FetchType.EAGER, orphanRemoval=false)    
    @PrimaryKeyJoinColumn
    private Sell sell;
	
	@Enumerated(EnumType.STRING)
	private PaymentStatus paymentStatus;	
	
	@NotNull
	@NotEmpty
	private double totalValue;

	public Payment() {

	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public double getValue() {
		return totalValue;
	}

	public void setValue(double value) {
		this.totalValue = value;
	}

	public Sell getSell() {
		return sell;
	}

	public void setSell(Sell sell) {
		this.sell = sell;
	}

	public PaymentStatus getPaymentStatus() {
		return paymentStatus;
	}

	public void setPaymentStatus(PaymentStatus paymentStatus) {
		this.paymentStatus = paymentStatus;
	}
}